/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Calendar;
import java.util.Date;

/**
 * <p>Project: javaseapp - Arr4
 * <p>Powered by webrx On 2021-08-04 09:49:29
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 16
 */
public class Arr6 {
    public static void main(String[] args) {
        //一维数组
        int[] i;
        Date[] ds;

        //要求声明一个数组，数组中什么都可以放入，这个数组必须为Object数组
        Object[] obj = new Object[5];
        obj[0] = 3;
        obj[0] = "ok";
        obj[1] = 1d;
        obj[2] = 3.5f;
        obj[3] = new Date();
        obj[4] = Calendar.getInstance();

        //二维
        int[][] ns = new int[3][5];
        ns[2][4] = 100;
        System.out.println(ns[1][2]);
        System.out.println(ns[2][4]);

        int[][] ns2 = new int[][]{{1, 2, 3}, {40, 50, 60}, {10, 200, 3000, 10000}};
        System.out.println(ns2[2][2]);
        System.out.println(ns2[2][3]);
        System.out.println("---------------------------------------");
        //遍历二维数组
        for (int[] a : ns2) {
            for (int a2 : a) {
                System.out.printf("%d ", a2);
            }
            System.out.println();
        }

    }

}
